//
//  RecycleSectionHeaderCollectionReusableView.m
//  BaseFrame
//
//  Created by ENERGY on 2018/5/3.
//  Copyright © 2018年 com.mxh. All rights reserved.
//

#import "RecycleSectionHeaderCollectionReusableView.h"

@interface RecycleSectionHeaderCollectionReusableView()
@property (nonatomic, strong)UILabel * titleLab;
@property (nonatomic, strong)UIButton * stateBtn;
@property (nonatomic, strong)UILabel * dateLab;
@end

@implementation RecycleSectionHeaderCollectionReusableView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.titleLab];
        [self addSubview:self.stateBtn];
        [self addSubview:self.dateLab];
        __weak typeof (self)weakSelf = self;
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.mas_left).offset(10/WIDTH_5S_SCALE);
            make.top.bottom.equalTo(weakSelf).offset(0);
            make.width.mas_equalTo(60/WIDTH_5S_SCALE);
        }];
        [self.stateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.titleLab.mas_right).offset(3/WIDTH_5S_SCALE);
            make.centerY.equalTo(weakSelf.titleLab.mas_centerY);
            make.height.mas_equalTo(20/WIDTH_5S_SCALE);
            make.width.mas_equalTo(50/WIDTH_5S_SCALE);
        }];
        [self.dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.mas_right).offset(-10/WIDTH_5S_SCALE);
            make.top.bottom.equalTo(weakSelf).offset(0);
        }];
        
    }return self;
}

#pragma mark - init
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_14;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _titleLab.text = @"衣服种类";
    }return _titleLab;
}

- (UILabel *)dateLab{
    if (!_dateLab) {
        _dateLab = [[UILabel alloc] init];
        _dateLab.font = DEF_FontSize_13;
        _dateLab.textColor = [UIColor blackColor];
        _dateLab.textAlignment = NSTextAlignmentRight;
        _dateLab.text = @"2018-01-01";
    }return _dateLab;
}

- (UIButton *)stateBtn{
    if (!_stateBtn) {
        _stateBtn = [[UIButton alloc] init];
        _stateBtn.titleLabel.font = DEF_FontSize_13;
        [_stateBtn setTitle:@"进行中" forState:UIControlStateNormal];
        [_stateBtn setBackgroundColor:getColor(@"dcdcdc")];
        [_stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _stateBtn.layer.cornerRadius = 6;
        _stateBtn.layer.masksToBounds = YES;
    }
    return _stateBtn;
}

@end
